<%@page import="com.alibaba.fastjson.JSONObject"%>
<%@page import="com.alibaba.fastjson.JSONArray"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<script type="text/javascript" src="js/jquery-1.11.0.js"></script>
<script type="text/javascript">
	$(function(){
		$(".gd_delete").click(function(){
			var id = $(this).attr("name");
			$.get("UpdateGood",{"id":id,type:3},function(){
				
			})
			return false;
		});
	});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@IMPORT url("css/core.css");
</style>
<title>Insert title here</title>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<base href="<%=basePath%>"/>
</head>
<body>
	<table>
		<thead>
			<tr>
				<th>商品名称</th>
				<th>商品价格</th>
				<th>商品数量</th>
				<th>商品图片</th>
				<th>商品状态</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<%
				Object object = request.getAttribute("list");
				if(object !=null){
					JSONArray array = (JSONArray)object;
					for(Object jsonObj:array){
						JSONObject json = (JSONObject)jsonObj;
			%>
					<tr>
						<th><%=json.getString("name_gd") %></th>
						<th><%=json.getString("price_gd") %></th>
						<th><%=json.getString("number_gd") %></th>
						<th><img alt="" src="<%=json.getString("imge_gd")%>"></th>
						<th><%
							int state = json.getIntValue("state");
							if(state ==1){
								out.print("商品已上架");
							}else{
								out.print("商品已下架");
							}
							%>
						</th>
						<th>
							<a href="updategood.jsp?id=<%=json.getString("id_gd")%>">修改</a>
						</th>
					</tr>
			<%			
					}
				}
			%>
		</tbody>
	</table>	
</body>
</html>